#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    double myPow(double x, int n)
    {
        if (n < 0)
        {
            x = 1 / x;
            n = abs(n);
        }
        if (n == 0)
        {
            return 1;

        }

        double nums = myPow(x, n / 2);

        if (n % 2 == 1)return nums * nums * x;
        return nums * nums;

    }
};